# $Id: makefile,v 1.33 2010/04/22 21:18:52 zahorjan Exp $

CC= gcc
MKDEP= gccmakedep

VARDIR= var
SRCS= testHash.c testqueue.c testtaskqueue.c testeventmanager.c factorydemo.c
OBJS= $(patsubst %.c,%.o,$(SRCS))
PROGRAMS=$(patsubst %.c,%,$(SRCS))

CFLAGS= -c -Wall -O0  -g -I$(VARDIR)/include -DUSE_SPINLOCK
LDFLAGS = -L$(VARDIR)/lib -lcse451p2 -lpthread -lrt 


LIBSRCS= $(wildcard $(VARDIR)/src/*.c)
LIBOBJS= $(patsubst %.c,%.o,$(LIBSRCS))

LIBNAME= cse451p2
LIBFILENAME=$(VARDIR)/lib/lib$(LIBNAME).a

testhash: testHash.o $(LIBFILENAME)
	${CC} testHash.o -o testhash ${LDFLAGS}

testqueue: testqueue.o $(LIBFILENAME)
	${CC} testqueue.o -o testqueue ${LDFLAGS}

testtaskqueue: testtaskqueue.o $(LIBFILENAME)
	${CC} testtaskqueue.o -o testtaskqueue ${LDFLAGS}

testeventmanager: testeventmanager.o $(LIBFILENAME)
	${CC} testeventmanager.o -o testeventmanager ${LDFLAGS}

factorydemo: factorydemo.o $(LIBFILENAME)
	${CC} factorydemo.o -o factorydemo ${LDFLAGS}


.PHONY: lib
lib: $(LIBFILENAME)

VPATH = .:$(VARDIR)/src

$(LIBFILENAME): $(LIBOBJS)
	@rm -f $(LIBFILENAME)
	ar r $(LIBFILENAME) $^

%.o : %.c
	$(CC) $(CFLAGS) -c $< -o $@

.PHONY: all clean cleanlib cleanall depend

all:	lib testqueue testtaskqueue testeventmanager factorydemo

clean:
	@rm -f ${OBJS} ${PROGRAMS} *~

cleanlib:
	@rm -f ${LIBOBJS} $(LIBFILENAME) $(VARLIB)/src/*~ $(VARLIB)/include/*~

cleanall: clean cleanlib depend

depend:
	@${MKDEP} -- ${CFLAGS} -- ${SRCS} ${LIBSRCS}
# DO NOT DELETE
testHash.o: testHash.c /usr/include/stdlib.h /usr/include/features.h \
 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/sys/types.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sys/select.h /usr/include/bits/select.h \
 /usr/include/bits/sigset.h /usr/include/bits/time.h \
 /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
 /usr/include/alloca.h var/include/hashTable.h var/include/factory.h \
 /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
 /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
 /usr/include/xlocale.h /usr/include/signal.h /usr/include/bits/setjmp.h \
 var/include/lockDef.h
testqueue.o: testqueue.c /usr/include/stdlib.h /usr/include/features.h \
 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/sys/types.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sys/select.h /usr/include/bits/select.h \
 /usr/include/bits/sigset.h /usr/include/bits/time.h \
 /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
 /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \
 /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
 /usr/include/xlocale.h /usr/include/signal.h /usr/include/bits/setjmp.h \
 var/include/queue.h var/include/factory.h var/include/lockDef.h
testtaskqueue.o: testtaskqueue.c /usr/include/stdlib.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
 /usr/include/gnu/stubs-32.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/sys/types.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sys/select.h /usr/include/bits/select.h \
 /usr/include/bits/sigset.h /usr/include/bits/time.h \
 /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
 /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \
 /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
 /usr/include/xlocale.h /usr/include/signal.h /usr/include/bits/setjmp.h \
 var/include/taskQueue.h var/include/factory.h var/include/lockDef.h
testeventmanager.o: testeventmanager.c /usr/include/stdlib.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
 /usr/include/gnu/stubs-32.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/sys/types.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sys/select.h /usr/include/bits/select.h \
 /usr/include/bits/sigset.h /usr/include/bits/time.h \
 /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
 /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \
 /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/string.h /usr/include/xlocale.h /usr/include/assert.h \
 var/include/eventManager.h var/include/factory.h /usr/include/pthread.h \
 /usr/include/sched.h /usr/include/bits/sched.h /usr/include/signal.h \
 /usr/include/bits/setjmp.h var/include/lockDef.h var/include/factory.h
factorydemo.o: factorydemo.c /usr/include/stdlib.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
 /usr/include/gnu/stubs-32.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/sys/types.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sys/select.h /usr/include/bits/select.h \
 /usr/include/bits/sigset.h /usr/include/bits/time.h \
 /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
 /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \
 /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/string.h /usr/include/xlocale.h var/include/factory.h \
 /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
 /usr/include/signal.h /usr/include/bits/setjmp.h var/include/lockDef.h
atomic_int.o: var/src/atomic_int.c /usr/include/pthread.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
 /usr/include/gnu/stubs-32.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sched.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/time.h /usr/include/bits/sched.h /usr/include/bits/time.h \
 /usr/include/xlocale.h /usr/include/signal.h /usr/include/bits/sigset.h \
 /usr/include/bits/pthreadtypes.h /usr/include/bits/setjmp.h \
 var/include/atomicInt.h var/include/factory.h /usr/include/stdlib.h \
 /usr/include/sys/types.h /usr/include/sys/select.h \
 /usr/include/bits/select.h /usr/include/sys/sysmacros.h \
 /usr/include/alloca.h /usr/include/stdio.h /usr/include/libio.h \
 /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 var/include/lockDef.h var/include/lockDef.h var/include/factory.h
eventManager.o: var/src/eventManager.c /usr/include/stdlib.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
 /usr/include/gnu/stubs-32.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/sys/types.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sys/select.h /usr/include/bits/select.h \
 /usr/include/bits/sigset.h /usr/include/bits/time.h \
 /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
 /usr/include/alloca.h /usr/include/string.h /usr/include/xlocale.h \
 var/include/eventManager.h var/include/factory.h /usr/include/stdio.h \
 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
 /usr/include/signal.h /usr/include/bits/setjmp.h var/include/lockDef.h \
 var/include/queue.h var/include/hashTable.h var/include/lockDef.h \
 var/include/factory.h var/include/taskQueue.h var/include/atomicInt.h
hashTable.o: var/src/hashTable.c /usr/include/stdlib.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
 /usr/include/gnu/stubs-32.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/sys/types.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sys/select.h /usr/include/bits/select.h \
 /usr/include/bits/sigset.h /usr/include/bits/time.h \
 /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
 /usr/include/alloca.h var/include/hashTable.h var/include/factory.h \
 /usr/include/stdio.h /usr/include/libio.h /usr/include/_G_config.h \
 /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
 /usr/include/xlocale.h /usr/include/signal.h /usr/include/bits/setjmp.h \
 var/include/lockDef.h var/include/linked_list.h var/include/utils.h \
 var/include/lockDef.h var/include/factory.h
linked_list.o: var/src/linked_list.c /usr/include/assert.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
 /usr/include/gnu/stubs-32.h /usr/include/stdio.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/bits/types.h /usr/include/bits/typesizes.h \
 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
 /usr/include/endian.h /usr/include/bits/endian.h \
 /usr/include/bits/byteswap.h /usr/include/sys/select.h \
 /usr/include/bits/select.h /usr/include/bits/sigset.h \
 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
 /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
 var/include/linked_list.h var/include/utils.h
queue.o: var/src/queue.c /usr/include/assert.h /usr/include/features.h \
 /usr/include/sys/cdefs.h /usr/include/bits/wordsize.h \
 /usr/include/gnu/stubs.h /usr/include/gnu/stubs-32.h \
 /usr/include/stdio.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/bits/types.h /usr/include/bits/typesizes.h \
 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 /usr/include/stdlib.h /usr/include/sys/types.h /usr/include/time.h \
 /usr/include/endian.h /usr/include/bits/endian.h \
 /usr/include/bits/byteswap.h /usr/include/sys/select.h \
 /usr/include/bits/select.h /usr/include/bits/sigset.h \
 /usr/include/bits/time.h /usr/include/sys/sysmacros.h \
 /usr/include/bits/pthreadtypes.h /usr/include/alloca.h \
 /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
 /usr/include/xlocale.h /usr/include/signal.h /usr/include/bits/setjmp.h \
 var/include/lockDef.h var/include/queue.h var/include/factory.h \
 var/include/lockDef.h var/include/factory.h
taskQueue.o: var/src/taskQueue.c /usr/include/stdlib.h \
 /usr/include/features.h /usr/include/sys/cdefs.h \
 /usr/include/bits/wordsize.h /usr/include/gnu/stubs.h \
 /usr/include/gnu/stubs-32.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stddef.h \
 /usr/include/sys/types.h /usr/include/bits/types.h \
 /usr/include/bits/typesizes.h /usr/include/time.h /usr/include/endian.h \
 /usr/include/bits/endian.h /usr/include/bits/byteswap.h \
 /usr/include/sys/select.h /usr/include/bits/select.h \
 /usr/include/bits/sigset.h /usr/include/bits/time.h \
 /usr/include/sys/sysmacros.h /usr/include/bits/pthreadtypes.h \
 /usr/include/alloca.h /usr/include/string.h /usr/include/xlocale.h \
 /usr/include/pthread.h /usr/include/sched.h /usr/include/bits/sched.h \
 /usr/include/signal.h /usr/include/bits/setjmp.h var/include/lockDef.h \
 var/include/queue.h var/include/factory.h /usr/include/stdio.h \
 /usr/include/libio.h /usr/include/_G_config.h /usr/include/wchar.h \
 /usr/lib/gcc/i586-redhat-linux/4.4.1/include/stdarg.h \
 /usr/include/bits/stdio_lim.h /usr/include/bits/sys_errlist.h \
 var/include/lockDef.h var/include/taskQueue.h var/include/factory.h
